{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5-final"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3.8.5 64-bit ('base': conda)",
   "metadata": {
    "interpreter": {
     "hash": "aa9e82663741a35949d10b71616b7da32b0b1a8a92bded1e278bf973221dadc2"
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "from tensorflow.keras import layers, Sequential"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = tf.random.normal([100, 32, 32, 3])\n",
    "x = tf.reshape(x, [-1, 3])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "layer = layers.BatchNormalization()\n",
    "network = Sequential([\n",
    "    layers.Conv2D(6, kernel_size=3, strides=1),\n",
    "    layers.BatchNormalization(),\n",
    "    layers.MaxPooling2D(pool_size=2, strides=2),\n",
    "    layers.ReLU(),\n",
    "    layers.Conv2D(16, kernel_size=3, strides=1),\n",
    "    layers.BatchNormalization(),\n",
    "    layers.MaxPooling2D(pool_size=2, strides=2),\n",
    "    layers.ReLU(),\n",
    "    layers.Flatten(),\n",
    "    layers.Dense(120, activation='relu'),\n",
    "    layers.Dense(84, activation='relu'),\n",
    "    layers.Dense(10)\n",
    "])\n",
    "\n",
    "# Training\n",
    "with tf.GradientTape() as tape:\n",
    "    x = tf.expand_dims(x, axis=3)\n",
    "    out = network(x, training=True)\n",
    "\n",
    "# Test\n",
    "for x, y in db_test:\n",
    "    x = tf.expand_dims(x, axis=3)    \n",
    "    out = network(x, training=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}